2ab86647d3eaf18314cf76d7ae1c9eda433ded55,bw-calendar-engine-core/src/main/java/org/bedework/calcore/hibernate/CoreEvents.java,CoreEvents,updateProxy,#BwEventProxy#,1483

Before Change


   * override.
   */
  private void updateProxy(final BwEventProxy proxy) throws CalFacadeException {
    HibSession sess = getSess();

    /* if this is a proxy for a recurrence instance of our own event
       then the recurrence instance should point at this override.
       Otherwise we just update the event annotation.
     */
    BwEventAnnotation override = proxy.getRef();
    if (debug) {
      debugMsg("Update override event " + override);
    }

    BwEvent mstr = override.getTarget();

    while (mstr instanceof BwEventAnnotation) {
      /* XXX The master may itself be an annotated event. We should really
         stop when we get to that point
       */
      /*
      BwEventProxy tempProxy = new BwEventProxy(mstr);
      if (some-condition-holds) {
        break;
      }
      */
      mstr = ((BwEventAnnotation)mstr).getTarget();
    }

//    if (mstr.getOwner().equals(getUser()) &&
    if (mstr.testRecurring()) {
      // A recurring event - retrieve the instance
      // from the recurrences table
      StringBuilder sb = new StringBuilder();

      sb.append("from ");
      sb.append(BwRecurrenceInstance.class.getName());
      sb.append(" rec ");
      sb.append(" where rec.master=:mstr ");
      sb.append(" and rec.recurrenceId=:rid ");

      sess.createQuery(sb.toString());

      sess.setEntity("mstr", mstr);
      sess.setString("rid", override.getRecurrenceId());

      BwRecurrenceInstance inst = (BwRecurrenceInstance)sess.getUnique();
      if (inst == null) {
        if (debug) {
          debugMsg("Cannot locate instance for " +

After Change


      debugMsg("Update override event " + override);
    }

    BwEvent mstr = override.getTarget();

    while (mstr instanceof BwEventAnnotation) {
      /* XXX The master may itself be an annotated event. We should really
         stop when we get to that point
       */
      /*
      BwEventProxy tempProxy = new BwEventProxy(mstr);
      if (some-condition-holds) {
        break;
      }
      */
      mstr = ((BwEventAnnotation)mstr).getTarget();
    }

//    if (mstr.getOwner().equals(getUser()) &&
    if (mstr.testRecurring()) {
      // A recurring event - retrieve the instance

      final BwRecurrenceInstance inst = 
              getInstance(mstr, 
                          override.getRecurrenceId());
      if (inst == null) {
        if (debug) {
          debugMsg("Cannot locate instance for " +